package com.all.play.mypsm.App;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.view.MotionEvent;

import com.all.play.mypsm.R;

/**
 * Created by 聪明一只哈 on 2018/3/30.
 * Time: 2018/3/30  20:00
 */

public class SplashActivity extends Activity {

    private Handler handler=new Handler();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);


        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                gotoMainAC();
            }
        },2000);

    }
    
    /*
     *跳转到主页面
     * */
    private void gotoMainAC() {
        startActivity(new Intent(SplashActivity.this, MainActivity.class));
        finish();
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {

        gotoMainAC();

        return super.onTouchEvent(event);
    }

    @Override
    protected void onDestroy() {
        handler.removeCallbacksAndMessages(null);
        super.onDestroy();
    }
}
